import request from "../utils/request";

/**
 * 添加角色
 */
export function addRole(data) {
  return request({
    url: "/api/role",
    method: "post",
    data: data,
  });
}

/**
 * 删除角色
 */
export function deleteRole(id) {
  return request({
    url: `/api/role/${id}`,
    method: "delete",
  });
}

/**
 * 更新角色
 */
export function updateRole(data) {
  return request({
    url: "/api/role",
    method: "put",
    data: data,
  });
}

/**
 * 角色详情
 */
export function getRole(id) {
  return request({
    url: `/api/role/${id}`,
    method: "get",
  });
}

/**
 * 角色列表
 */
export function listRole(query) {
  return request({
    url: "/api/role",
    method: "get",
    params: query,
  });
}
